import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  username = '';
  password = '';
  remember = true;


  submitForm(): void {
    if (this.username == '' || this.password == ''){
      let content = '用户名或密码不能为空！';
      this.message.create('error', content,{nzDuration: 2000});
    }else {
      let content = `登录成功--》 ${"用户名："+this.username+"\n"+"密码："+this.password}`;
      this.message.create('success', content,{nzDuration: 2000});
      this.router.navigateByUrl('home').then();
    }
    console.log(this.username+"="+this.password+"="+this.remember);
  }

  constructor(
    private message: NzMessageService,
    private router: Router
  ) {

  }

  ngOnInit(): void {

  }

}
